package IO流.对象流;

import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
//反序列化  字节到Java
public class ObjectInputDemo {
    public static void main(String[] args) {
        ObjectInputStream ois=null;
        try {
           ois=new ObjectInputStream(new FileInputStream("e:/dd4.txt"));
            User user= (User)ois.readObject();//强转成User类
            System.out.println(user.getUserid()+""+user.getUserage()+""+user.getUsername());
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            try {
                if(ois!=null)ois.close();

            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
}

